package easydst;
import java.util.ArrayList;
import java.util.List;


import util.Utilities;


public class TestCase {
	
	List<Machine> machines;
	
	public TestCase(List<Machine> machines){
		this.machines = machines;
		createAgentsIntoMachines();
	}
	
	public TestCase(String fileWithMachines){
		new TestCase(createMachines(Utilities.getMachinesFromFile(fileWithMachines))); 		
	}

	private List<Machine> createMachines(List<String> machinesFromFile) {
		List<Machine> machines = new ArrayList<Machine>();
		for (String aMachineName : machinesFromFile){
			machines.add(new Machine(aMachineName));
		}		
		return machines;
	}

	//Create the test agent into machines
	private void createAgentsIntoMachines() {
		for (Machine machine : machines){
			/*TODO
			 * Algoritmo:
			 * copiar o script para a machine (Script: Iniciar o rmiregistry e chamar o main do agent)
			 * torna o arquivo executável
			 * executar o script
			 * verificar se iniciou o agente (?) 
			 */
			
			
			Utilities.createAgentsIntoMachine(machine);
		}		
	}
	
	

}
